package com.think.musicdiary

import com.fanketly.musicdiary.data.network.RetrofitNetwork
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.Json
import org.junit.Test

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun getMusicInfoByMood(aa: A.() -> Unit) {
        println(aa(A()))
//
//        b {
//            "B"
//        }
//        c {
//            "C"
//        }
//
//        d {
//            "D"
//        }

//        a.invoke(A())
//        runBlocking {
//            val musicInfo = RetrofitNetwork(Json { ignoreUnknownKeys = true }).getMusicInfo("烦恼")
//            println(musicInfo.songName)
//        }

    }

    fun d(a: A.() -> String) {
        println(a(A()))
    }

    inline fun b(bb: () -> String) {
        println(bb())
    }

    fun c(cc: () -> String) {
        println(cc())
    }

    @Test
    fun testLambdaA() {
        d {
            ""
        }
        c {
            ""
        }
//        d {
//            "D"
//        }
    }


}

class A {
    fun a() {
        println("A")
    }
}